import Layout from "@/views/Layout";
// import BigPage from '@/views/BigPage'
import Login from "@/views/Login";
import Router from "vue-router";

let routes = [
  {
    path: "/login",
    component: Login,
  },
  {  
    path: "/",
    component: Layout,
    redirect: "/bigPage",
    children: [
      {
        path: "bigPage",
        name: "bigPage",

        /**
         * 3种懒加载方式
         *
         * 1.路由懒加载
         * 2.webpack  require.ensure()
         * 3. vue异步（组件）加载
         **/

        // 1. webpackChunkName 指定打包后js名称 ————— 同名的合并成同个js文件
        component: () =>
          import(/* webpackChunkName: 'ImportFuncDemo' */ "@/views/BigPage"),
        // 单独的js文件
        // component: () => import('@/views/BigPage'),

        // 2. webpack ： require.ensure
        // component: r => require.ensure([], () => r(require('@/views/BigPage')), 'BigPage') },

        // 3. vue异步（组件）加载
        // component: resolve => require(['@/views/BigPage'],resolve)
      },
      {
        path: "process",
        name: "process",
        component: () => import("@/views/Process"),
      },
      {
        path: "process1",
        name: "process1",
        component: () => import("@/views/Process/process1"),
      },
      {
        path: "process2",
        name: "process2",
        component: () => import("@/views/FlowMain"),
      },
      {
        path: "FlowDemo",
        name: "FlowDemo",
        component: () => import("@/views/FlowDemo"),
      },
      {
        path: "ShopCar",
        name: "ShopCar",
        component: () => import("@/views/ShopCar"),
      },
    ],
  },
];

const router = new Router({
  // mode: "history",
  // base: "/process",
  routes,
});

export default router;
